﻿/*
SINACOR - BMF&Bovespa
Arquivo: NoDiscricionaria.cs
Criado em: 07-abr-2010 15:53:20
Arquiteto Responsável: p-RAMelo
*/
using System;
using System.Collections.Generic;
using System.Text;
using Sinacor.Infra.UI.Common;


namespace Sinacor.UI.Bovespa.ManutencaoOrdens.Model 
{
	/// <summary>
	/// Nó representa se a ordem é discricionário ou não
	/// </summary>
	[Serializable]
	public class NoDiscricionaria : BaseModel, Sinacor.Infra.UI.Common.IHierarchicalItem<Model.NoTipoObjetoConsulta,Model.NoSituacaoCasamento,ModelCollection<Model.NoSituacaoCasamento>> 
	{

		#region Construtor
		
        /// <summary>
        /// Construtor padrão
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="discricionaria"></param>
		public NoDiscricionaria(Model.NoTipoObjetoConsulta parent, bool discricionaria)
		{
			this._discricionaria = discricionaria;
			this._parent = parent;
            _children = new ModelCollection<NoSituacaoCasamento>();		
		}

		#endregion

		#region Atributos

		private ModelCollection<Model.NoSituacaoCasamento> _children;
		private bool _discricionaria;
		private Model.NoTipoObjetoConsulta _parent;

		#endregion

		#region Métodos

        /// <summary>
        /// Children
        /// </summary>
        /// <returns></returns>
		public ModelCollection<Model.NoSituacaoCasamento> Children
		{
            get 
            {
                return _children; 
            }            
		}

        /// <summary>
        /// Discricionária
        /// </summary>
        /// <returns></returns>
		public bool Discricionaria
		{
            get { return _discricionaria; }
		}

        /// <summary>
        /// Children
        /// </summary>
		System.Collections.IEnumerable Sinacor.Infra.UI.Common.IHierarchicalItem.Children
		{
            get { return (System.Collections.IEnumerable)_children; }
		}

        /// <summary>
        /// Parent
        /// </summary>
		public Model.NoTipoObjetoConsulta Parent
		{
            get 
            { 
                return _parent; 
            }
            set
            {
                SetValue<Model.NoTipoObjetoConsulta>("Parent", ref _parent, value);
            }
		}

        /// <summary>
        /// Parent
        /// </summary>
        Sinacor.Infra.UI.Common.IHierarchicalItem Sinacor.Infra.UI.Common.IHierarchicalItem.Parent
        {
            get { return (IHierarchicalItem)_parent; }
        }

        /// <summary>
        /// Text
        /// </summary>
		public String Text
		{            
            get
            {
                if(_discricionaria)
                    return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.ManutencaoOrdens.Label.Discricionaria").ToString();
                else
                    return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.ManutencaoOrdens.Label.NaoDiscricionaria").ToString();
            }           
		}

		#endregion

	}

}